
import { createStore } from "vuex";
import doctorUsepres from "@/store/doctorUsepres/doctorUsepres.js";


export default createStore({
  state: {
    user_type: '', //2是患者，1是医生
    //用户登陆状态
    appuserInfo: {  },

    //登录信息
    isLogin:false,
    //个人信息
    myInfo:{
      img:'',
      name:''
    },
  //  聊天对象信息
    userInfo:{
      img:'',
      name:''
    },
    //聊天列表
    userList:[],
  //  聊天记录
    chatMessageList:[]
  },
  mutations: {
    recordUserType(state, payload) {
      let { user_type } = payload;
      state.user_type = user_type;
    },
    saveappuserInfo(state, payload) {
      state.appuserInfo = payload;
    },
  },
  getters: {
    getUserTypeIsPatient(state) {
      let user_type = state.user_type;
      //判断是否是患者
      return user_type == 2 ? true : false;
    },
    //获取登录状态
    isLogin: state => state.isLogin,
  },
  actions: {},
  modules: {
    doctorUsepres,
  },
});
